package cn.itcast.classSM.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="T_USER")
//用户表
public class User {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "U_UID")
	private Integer uid; //工号
	@Column(name = "U_USERNAME")
	private String username; //用户名
	@Column(name = "U_PASSWORD")
	private String password; //密码
	@Column(name = "U_NAME")
	private String name; //姓名
	@Column(name = "U_TELEPHONE")
	private String telephone; //电话号码
	@Column(name = "U_POSITION")
	private String position; //职位
	@Column(name = "U_POSTED_TIME")
	@Temporal(TemporalType.DATE)
	private Date postedTime; //入职时间
	@Column(name = "U_POWER")
	private Integer power; //权限  0.管理员 1.普通用户 
	
	@OneToMany(mappedBy = "cuser")
	private Set<Clazz> clazzs = new HashSet<Clazz>(); //班级
	
	@OneToMany(mappedBy = "cmuser")
	private Set<CheckMessage> checkMessages = new HashSet<CheckMessage>(); //基本信息
	
	public Set<CheckMessage> getCheckMessages() {
		return checkMessages;
	}
	public void setCheckMessages(Set<CheckMessage> checkMessages) {
		this.checkMessages = checkMessages;
	}
	public Set<Clazz> getClazzs() {
		return clazzs;
	}
	public void setClazzs(Set<Clazz> clazzs) {
		this.clazzs = clazzs;
	}
	public Integer getUid() {
		return uid;
	}
	public void setUid(Integer uid) {
		this.uid = uid;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public Date getPostedTime() {
		return postedTime;
	}
	public void setPostedTime(Date postedTime) {
		this.postedTime = postedTime;
	}
	public Integer getPower() {
		return power;
	}
	public void setPower(Integer power) {
		this.power = power;
	}
	@Override
	public String toString() {
		return "User [uid=" + uid + ", username=" + username + ", password=" + password + ", name=" + name
				+ ", telephone=" + telephone + ", position=" + position + ", postedTime=" + postedTime + ", power="
				+ power + ", clazzs=" + clazzs + ", checkMessages=" + checkMessages + "]";
	}
	
}
